package ch01;

import java.util.Scanner;

public class Game {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int type;
        boolean isExit = false;
        System.out.println("欢迎来到星沐生态农场！");
        AppleTree appleTree = null;
        Corn corn = null;
        while (!isExit){
            System.out.println("");
            System.out.println("请选择：1、种植作物 2、查看生长状态 3、收获果实 4、退出");
            switch (input.nextInt()){
                case 1:
                    System.out.println("请输入您要种植的作物：1、苹果树 2、玉米");
                    type = input.nextInt();
                    switch (type){
                        case 1:
                            System.out.println("请选择苹果树品种：1、富士 2、金帅");
                            String brand = "";
                            switch(input.nextInt()){
                                case 1: brand = "富士";break;
                                case 2: brand = "金帅";break;
                            }
                            appleTree = new AppleTree(brand);
                            appleTree.print();
                            break;
                        case 2:
                            System.out.println("请选择收割机类型：1、家用收割机（50元） 2、联合收割机（100元）");
                            double harvestCost = 0;
                            switch(input.nextInt()){
                                case 1: harvestCost = 50;break;
                                case 2: harvestCost = 100;break;
                            }
                            corn = new Corn(harvestCost);
                            corn.print();
                            break;
                    }
                    break;
                case 2:
                    corn.printGrowReport(5);
                    corn.harvest();
                    corn.printGrowReport(10);
                    corn.harvest();
                    corn.harvest();
                    corn.printGrowReport(15);
                    corn.harvest();
                    break;
                case 3:
//                    appleTree.harvest();
                    break;
                case 4:
                    System.out.println("欢迎下次再来！");
                    isExit = true;
                    break;
            }
        }
    }
}
